<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../../_template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core">

    <ui:define name="centro">

        <h:form>

            <p:outputLabel value="Banco - Incluir" rendered="#{empty bancoBean.banco.id}" style="font-size: x-large" styleClass="labelInserir" />
            <p:outputLabel value="Alterar Banco" rendered="#{not empty bancoBean.banco.id}" style="font-size: x-large" styleClass="labelAlterar" />

            <p:fieldset styleClass="fieldsetInsert">
                <p:messages />
                <h:panelGrid columns="2" >
                    <h:panelGrid columns="1">
                        <p:outputLabel style="margin-right: 15px; text-align: left;" value="Número do Banco " for="nBanco" /> 
                        <p:inputText id="nBanco" value="#{bancoBean.banco.numeroBanco}" required="true" style="width: 100px" 
                                     requiredMessage="O campo 'Número do Banco' deve ser preenchido!" >
                            <p:message for="nBanco" />
                        </p:inputText>
                    </h:panelGrid>

                    <h:panelGrid columns="1">
                        <p:outputLabel style="margin-right: 5px; text-align: left;" value="Nome do banco " for="nomeBanco" /> 

                        <p:inputText id="nomeBanco" value="#{bancoBean.banco.nomeBanco}" style="width: 500px;" required="true"  
                                     requiredMessage="O campo 'Nome do banco' deve ser preenchido!">
                        </p:inputText>
                    </h:panelGrid>
                </h:panelGrid>
                <br/>
                <br/>
                <p:commandButton value="Gravar" action="#{bancoBean.gravar()}" rendered="#{empty bancoBean.banco.id}" 
                                 style="margin-right: 10px;" icon="ui-icon-check" ajax="false" />
                <p:commandButton value="Alterar" action="#{bancoBean.gravar()}" rendered="#{not empty bancoBean.banco.id}" style="margin-right: 10px;" icon="ui-icon-check" >
                    <p:confirm header="Confirmação" message="Deseja alterar a informação?" icon="ui-icon-alert" />
                    <p:confirmDialog global="true"  showEffect="fade" >
                        <p:commandButton value="Sim" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
                        <p:commandButton value="Não" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
                    </p:confirmDialog>
                </p:commandButton>
                        <p:commandButton value="Voltar" action="#{bancoBean.voltar}" immediate="true" ajax="false" />

            </p:fieldset>
        </h:form>


    </ui:define>

</ui:composition>
